package com.xuxin.pda.video;

import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.blankj.utilcode.util.BarUtils;
import com.shuyu.gsyvideoplayer.GSYBaseActivityDetail;
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder;
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer;
import com.xuxin.pda.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by xu_xin
 * Created on 2020.06.29 0020
 */
public class VideoActivity extends GSYBaseActivityDetail<StandardGSYVideoPlayer> implements View.OnClickListener {
    @BindView(R.id.title_name)
    TextView title_name;
    @BindView(R.id.title_left)
    ImageView title_left;
    @BindView(R.id.title_right)
    ImageView title_right;

    @BindView(R.id.video_player)
    StandardGSYVideoPlayer video_player;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        try {
            BarUtils.setStatusBarVisibility(this, true);
            BarUtils.setStatusBarLightMode(this, true);
            BarUtils.setStatusBarColor(this, Color.TRANSPARENT);
            setContentView();
            ButterKnife.bind(this);
            initView();
            initData();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void setContentView() {
        setContentView(R.layout.activity_video);
    }

    public void initView() {
        title_name.setText("普通视频");
        video_player.getTitleTextView().setVisibility(View.GONE);
        video_player.getBackButton().setVisibility(View.GONE);
        initVideoBuilderMode();
    }

    public void initData() {
    }

    public void onComplete() {

    }

    @Override
    @OnClick({R.id.title_left})
    public void onClick(View view) {
        int id = view.getId();
        if (id == R.id.title_left) {
            finish();
        }
    }

    @Override
    public StandardGSYVideoPlayer getGSYVideoPlayer() {
        return video_player;
    }

    @Override
    public GSYVideoOptionBuilder getGSYVideoOptionBuilder() {
        return new GSYVideoOptionBuilder()
                .setUrl("http://9890.vod.myqcloud.com/9890_4e292f9a3dd011e6b4078980237cc3d3.f20.mp4")
                .setCacheWithPlay(true)
                .setVideoTitle(" ")
                .setIsTouchWiget(true)
                .setRotateViewAuto(false)
                .setLockLand(false)
                .setShowFullAnimation(false)
                .setNeedLockFull(true)
                .setSeekRatio(1);
    }

    @Override
    public void clickForFullScreen() {
    }

    @Override
    public boolean getDetailOrientationRotateAuto() {
        return true;
    }
}